Vacuum up more crumbs of the NEW_STRING paths for cases that are "obviously"
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 24 Feb 2014 07:03:06 +0000 (07:03 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 24 Feb 2014 07:03:06 +0000 (07:03 +0000)
correct.  The ones that remain really are essentially TODO/FIXME for otherwise
problematic code.

git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4760 f51c46e8-681c-474f-0cfe-069cfd0219fb

34 files changed:
gpsbabel/defs.h
gpsbabel/dmtlog.cc
gpsbabel/easygps.cc
gpsbabel/garmin.cc
gpsbabel/garmin_device_xml.cc
gpsbabel/garmin_gpi.cc
gpsbabel/garmin_txt.cc
gpsbabel/gbfile.h
gpsbabel/googledir.cc
gpsbabel/gpx.cc
gpsbabel/igc.cc
gpsbabel/ignrando.cc
gpsbabel/ik3d.cc
gpsbabel/interpolate.cc
gpsbabel/lowranceusr4.cc
gpsbabel/maggeo.cc
gpsbabel/mapsource.cc
gpsbabel/mkshort.cc
gpsbabel/mmo.cc
gpsbabel/naviguide.cc
gpsbabel/netstumbler.cc
gpsbabel/nmea.cc
gpsbabel/raymarine.cc
gpsbabel/stmsdf.cc
gpsbabel/stmwpp.cc
gpsbabel/tef_xml.cc
gpsbabel/tmpro.cc
gpsbabel/tpg.cc
gpsbabel/unicsv.cc
gpsbabel/vitosmt.cc
gpsbabel/waypt.cc
gpsbabel/wfff_xml.cc
gpsbabel/xmlgeneric.cc
gpsbabel/xol.cc

index 8e918270925bde5ea33d3afa64f58c2790154647..a71535a56b6a77a4db84e26f555b7a1dcea03b80 100644 (file)
@@ -43,8 +43,6 @@
 # include "src/core/datetime.h"
 
 #define CSTR(qstr) (qstr.toUtf8().constData())
-#define CSTRE_(qstr, enc) (enc->fromUnicode(qstr).constData())
-#define CSTRE(qstr) (CSTRE_(qstr, codec))
 
 /*
  * Amazingly, this constant is not specified in the standard...
@@ -431,22 +429,20 @@ const global_trait* get_traits();
 #define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member) : (def))
 #define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0
 #define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member)
+
+#define CSTRc(qstr) (qstr.toLatin1().constData())
+// Maybe the XmlGeneric string callback really shouldn't have a type
+// of its own; this was a crutch during the move from char* to QString.
+// It's "just" a search and replace to make it go away, but it might
+// be convenient to overload some day.
+typedef const QString& xg_string;
+
 /*
  * This is a waypoint, as stored in the GPSR.   It tries to not
  * cater to any specific model or protocol.  Anything that needs to
  * be truncated, edited, or otherwise trimmed should be done on the
  * way to the target.
  */
-#if NEW_STRINGS 
-  typedef QString String;
-  #define CSTRc(qstr) (qstr.toLatin1().constData())
-  typedef const QString& xg_string;
-#else
-  #define CSTRc(qstr) (qstr)
-  typedef char* String;
-  typedef const char* xg_string;
-#endif
-
 class Waypoint
 {
 private:
@@ -480,20 +476,20 @@ public:
    * minimum length for shortname is 6 characters for NMEA units,
    * 8 for Magellan and 10 for Vista.   These are only guidelines.
    */
-  String shortname;
+  QString shortname;
   /*
    * description is typically a human readable description of the
    * waypoint.   It may be used as a comment field in some receivers.
    * These are probably under 40 bytes, but that's only a guideline.
    */
-  String description;
+  QString description;
   /*
    * notes are relatively long - over 100 characters - prose associated
    * with the above.   Unlike shortname and description, these are never
    * used to compute anything else and are strictly "passed through".
    * Few formats support this.
    */
-  String notes;
+  QString notes;
 
   /* TODO: UrlLink should probably move to a "real" class of its own.
    */
@@ -563,8 +559,8 @@ class route_head
 public:
   queue Q;             /* Link onto parent list. */
   queue waypoint_list; /* List of child waypoints */
-  String rte_name;
-  String rte_desc;
+  QString rte_name;
+  QString rte_desc;
   QString rte_url;
   int rte_num;
   int rte_waypt_ct;            /* # waypoints in waypoint list */
@@ -741,7 +737,7 @@ short_handle MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
 #define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__)
 #define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__)
 #endif
-String mkshort_from_wpt(short_handle h, const Waypoint* wpt);
+QString mkshort_from_wpt(short_handle h, const Waypoint* wpt);
 void mkshort_del_handle(short_handle* h);
 void setshort_length(short_handle, int n);
 void setshort_badchars(short_handle,  const char*);
@@ -898,9 +894,6 @@ void* xcalloc(size_t nmemb, size_t size);
 void* xmalloc(size_t size);
 void* xrealloc(void* p, size_t s);
 void xfree(const void* mem);
-#ifndef NEW_STRINGS
-char* xstrdup(const char* s);
-#endif
 char* xstrdup(const QString& s);
 char* xstrndup(const char* s, size_t n);
 char* xstrndupt(const char* s, size_t n);
@@ -964,7 +957,7 @@ const char* xstrrstr(const char* s1, const char* s2);
 void rtrim(char* s);
 char* lrtrim(char* s);
 int xasprintf(char** strp, const char* fmt, ...) PRINTFLIKE(2, 3);
-int xasprintf(String* strp, const char* fmt, ...) PRINTFLIKE(2, 3);
+int xasprintf(QString* strp, const char* fmt, ...) PRINTFLIKE(2, 3);
 int xvasprintf(char** strp, const char* fmt, va_list ap);
 char* strupper(char* src);
 char* strlower(char* src);
index 0adad2eaf9247899a0e27dd812ebe14436b367e4..88bfd3f3e8f7b8d6d10dd9a3ab930b87adbc5be5 100644 (file)
@@ -150,11 +150,7 @@ finalize_pt(Waypoint* wpt)
 static void
 tlog3a_xgcb_version(xg_string args, const QXmlStreamAttributes*)
 {
-#if NEW_STRINGS
   if (args != "1") {
-#else
-  if (strcmp(args, "1") != 0) {
-#endif
     fatal(MYNAME ": Unsupported file version '%s'!\n", CSTRc(args));
   }
 }
index b5986c379866fcc5996578c6ced2ef979e0572ae..49ecea6c6f936f070110f1d9fc6211947398e14e 100644 (file)
@@ -156,19 +156,11 @@ static void
 ez_disp(const Waypoint* wpt)
 {
   gbfputc('W', file_out);
-#if NEW_STRINGS
   if (!wpt->shortname.isEmpty()) {
-#else
-  if (wpt->shortname) {
-#endif
     gbfputc(1, file_out);
     gbfputpstr(wpt->shortname, file_out);
   }
-#if NEW_STRINGS
   if (!wpt->description.isEmpty()) {
-#else
-  if (wpt->description) {
-#endif
     gbfputc(3, file_out);
     gbfputpstr(wpt->description, file_out);
   }
@@ -181,11 +173,7 @@ ez_disp(const Waypoint* wpt)
 
   gbfputc(0x64, file_out);
   gbfputdbl(wpt->longitude, file_out);
-#if NEW_STRINGS
   if (!wpt->notes.isEmpty()) {
-#else
-  if (wpt->notes) {
-#endif
     gbfputc(5, file_out);
     gbfputpstr(wpt->notes, file_out);
   }
index 5d1a9d6cdb476818a96324440d5afda58241d72e..704c75c36fb61496fee3fcabd3b7fb91f2df403b 100644 (file)
@@ -911,7 +911,6 @@ waypoint_prepare(void)
     char* ident;
     char obuf[256];
 
-#if NEW_STRINGS 
     QString src;
     if (!wpt->description.isEmpty()) {
       src = wpt->description;
@@ -919,15 +918,6 @@ waypoint_prepare(void)
     if (!wpt->notes.isEmpty()) {
       src = wpt->notes;
     }
-#else
-    char *src = NULL;
-    if (wpt->description) {
-      src = wpt->description;
-    }
-    if (wpt->notes) {
-      src = wpt->notes;
-    }
-#endif
 
     /*
      * mkshort will do collision detection and namespace
@@ -949,11 +939,7 @@ waypoint_prepare(void)
 
     // If we were explictly given a comment from GPX, use that.
     //  This logic really is horrible and needs to be untangled.
-#if NEW_STRINGS
     if (!wpt->description.isEmpty() &&
-#else
-    if (wpt->description &&
-#endif
         global_opts.smart_names && !wpt->gc_data->diff) {
       memcpy(tx_waylist[i]->cmnt, CSTRc(wpt->description), strlen(CSTRc(wpt->description)));
     } else {
@@ -1045,11 +1031,7 @@ route_hdr_pr(const route_head* rte)
 {
   (*cur_tx_routelist_entry)->rte_num = rte->rte_num;
   (*cur_tx_routelist_entry)->isrte = 1;
-#if NEW_STRINGS
   if (!rte->rte_name.isEmpty()) {
-#else
-  if (rte->rte_name) {
-#endif
     strncpy((*cur_tx_routelist_entry)->rte_ident, CSTRc(rte->rte_name),
             sizeof((*cur_tx_routelist_entry)->rte_ident));
   }
@@ -1092,13 +1074,8 @@ route_waypt_pr(const Waypoint* wpt)
   // This was strncpy(rte->ident, wpt->shortname, sizeof(rte->ident));
   char* d;
   d = rte->ident;
-#if NEW_STRINGS
   for (int idx = 0; idx < wpt->shortname.length(); idx++) {
     int c = wpt->shortname[idx].toLatin1();
-#else
-  for (char* s = wpt->shortname; *s; s++) {
-    int c = *s;
-#endif
     if (receiver_must_upper && isalpha(c)) {
       c = toupper(c);
     }
@@ -1151,11 +1128,7 @@ static void
 track_hdr_pr(const route_head* trk_head)
 {
   (*cur_tx_tracklist_entry)->ishdr = gpsTrue;
-#if NEW_STRINGS
   if (!trk_head->rte_name.isEmpty()) {
-#else
-  if (trk_head->rte_name) {
-#endif
     strncpy((*cur_tx_tracklist_entry)->trk_ident, CSTRc(trk_head->rte_name), sizeof((*cur_tx_tracklist_entry)->trk_ident));
     (*cur_tx_tracklist_entry)->trk_ident[sizeof((*cur_tx_tracklist_entry)->trk_ident)-1] = 0;
   } else {
@@ -1172,11 +1145,7 @@ track_waypt_pr(const Waypoint* wpt)
   (*cur_tx_tracklist_entry)->lon = wpt->longitude;
   (*cur_tx_tracklist_entry)->alt = (wpt->altitude != unknown_alt) ? wpt->altitude : 1e25;
   (*cur_tx_tracklist_entry)->Time = wpt->GetCreationTime().toTime_t();;
-#if NEW_STRINGS
   if (!wpt->shortname.isEmpty()) {
-#else
-  if (wpt->shortname) {
-#endif
     strncpy((*cur_tx_tracklist_entry)->trk_ident, CSTRc(wpt->shortname), sizeof((*cur_tx_tracklist_entry)->trk_ident));
     (*cur_tx_tracklist_entry)->trk_ident[sizeof((*cur_tx_tracklist_entry)->trk_ident)-1] = 0;
   }
index cc4735afb1e757353e60f607eb9f6df9e0e3ac2c..3157ba7fc9b6faab40c98a75690b1063d69bee48 100644 (file)
@@ -40,11 +40,7 @@ jmp_buf gdx_jmp_buf;
 
 void type_s(xg_string args, const QXmlStreamAttributes*)
 {
-#if NEW_STRINGS
   type = args.compare("GPSData");
-#else
-  type = strcmp(args, "GPSData");
-#endif
 }
 
 void device_s(xg_string args, const QXmlStreamAttributes*)
@@ -81,11 +77,7 @@ void dir_s(xg_string args, const QXmlStreamAttributes*)
   if (type) {
     return;
   }
-#if NEW_STRINGS
   if ((args == "OutputFromUnit")) {
-#else
-  if (0 == strcmp(args, "OutputFromUnit")) {
-#endif
     xasprintf(&my_gdx_info->from_device.path,  "%s%c%s",
               mountpoint, GB_PATHSEP, path);
     my_gdx_info->from_device.basename = xstrdup(base);
@@ -94,11 +86,7 @@ void dir_s(xg_string args, const QXmlStreamAttributes*)
               my_gdx_info->from_device.path,
               my_gdx_info->from_device.basename,
               my_gdx_info->from_device.extension);
-#if NEW_STRINGS
   } if ((args == "InputToUnit")) {
-#else
-  } else if (0 == strcmp(args, "InputToUnit")) {
-#endif
     xasprintf(&my_gdx_info->to_device.path,  "%s%c%s",
               mountpoint, GB_PATHSEP, path);
     my_gdx_info->to_device.basename = xstrdup(base);
index 62c0e400eec4b7d6e258b356edfa5358708bac0d..51a3f2a14191b1aba5936980d8b0e51df767743d 100644 (file)
@@ -396,11 +396,7 @@ read_poi(const int sz, const int tag)
 
   (void) gbfgetint16(fin);     /* ? always 1 ? */
   (void) gbfgetc(fin);         /* seems to 1 when extra options present */
-#if NEW_STRINGS
-  wpt->shortname = gpi_read_string("Shortname");
-#else
   wpt->shortname = gpi_read_string("Shortname");
-#endif
 
   while (gbftell(fin) < (gbsize_t)(pos + sz - 4)) {
     int tag = gbfgetint32(fin);
@@ -589,18 +585,10 @@ read_tag(const char* caller, const int tag, Waypoint* wpt)
       break;
     }
 
-#if NEW_STRINGS
     if (!wpt->description.isEmpty()) {
-#else
-    if (wpt->description) {
-#endif
       wpt->notes = str;
     } else {
-#if NEW_STRINGS
       wpt->description = str;
-#else
-      wpt->description = str;
-#endif
     }
     break;
 
@@ -752,11 +740,7 @@ compare_wpt_cb(const queue* a, const queue* b)
 {
   const Waypoint* wa = (Waypoint*) a;
   const Waypoint* wb = (Waypoint*) b;
-#if NEW_STRINGS
   return wa->shortname.compare(wb->shortname);
-#else
-  return strcmp(wa->shortname, wb->shortname);
-#endif
 }
 
 static char
@@ -765,25 +749,6 @@ compare_strings(const QString& s1, const QString& s2)
   return s1.compare(s2);
 }
 
-#if !NEW_STRINGS
-static char
-compare_strings(const char* s1, const char* s2)
-{
-  if (s1 == s2) {
-    return 0;
-  } else if (s1) {
-    if (s2) {
-      return strcmp(s1, s2);
-    } else {
-      return 1;
-    }
-  } else {
-    return 1;
-  }
-}
-#endif
-
-
 static writer_data_t*
 wdata_alloc()
 {
@@ -927,11 +892,7 @@ wdata_compute_size(writer_data_t* data)
 
     res += 12;         /* tag/sz/sub-sz */
     res += 19;         /* poi fixed size */
-#if NEW_STRINGS
     res += wpt->shortname.length();
-#else
-    res += strlen(wpt->shortname);
-#endif
     if (! opt_hide_bitmap) {
       res += 10;  /* tag(4) */
     }
@@ -1291,13 +1252,7 @@ enum_waypt_cb(const Waypoint* ref)
   wpt = new Waypoint(*ref);
 
   if (*opt_unique == '1') {
-#if NEW_STRINGS
     wpt->shortname = mkshort(short_h, wpt->shortname);
-#else
-    char* str = mkshort(short_h, wpt->shortname);
-    xfree(wpt->shortname);
-    wpt->shortname = str;
-#endif
   }
 
   wdata_add_wpt(wdata, wpt);
index 0e624c7e432ebb6afb90308c997bb4e6f056dd2c..ff67ed335b5e6db99679429aec6500d8b29ec98c 100644 (file)
@@ -226,11 +226,7 @@ sort_waypt_cb(const void* a, const void* b)
 {
   const Waypoint* wa = *(Waypoint**)a;
   const Waypoint* wb = *(Waypoint**)b;
-#if NEW_STRINGS
   return wa->shortname.compare(wb->shortname, Qt::CaseInsensitive);
-#else
-  return case_ignore_strcmp(QString::fromLatin1(wa->shortname), QString::fromLatin1(wb->shortname));
-#endif
 }
 
 
@@ -354,11 +350,7 @@ print_position(const Waypoint* wpt)
   if (! valid) {
     gbfprintf(fout, "#####\n");
     fatal(MYNAME ": %s (%s) is outside of convertable area \"%s\"!\n",
-#if NEW_STRINGS
           wpt->shortname.isEmpty() ? "Waypoint" : CSTR(wpt->shortname),
-#else
-          wpt->shortname ? CSTRc(wpt->shortname) : "Waypoint",
-#endif
           pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0),
           gt_get_mps_grid_longname(grid_index, MYNAME));
   }
@@ -566,19 +558,11 @@ write_waypt(const Waypoint* wpt)
     wpt_type = gt_waypt_class_names[0];
   }
 
-#if NEW_STRINGS
   gbfprintf(fout, "Waypoint\t%s\t", CSTRc(wpt->shortname));
-#else
-  gbfprintf(fout, "Waypoint\t%s\t", (wpt->shortname) ? CSTRc(wpt->shortname) : "");
-#endif
   if (wpt_class <= gt_waypt_class_airport_ndb) {
     QString temp = wpt->notes;
     if (temp.isEmpty()) {
-#if NEW_STRINGS
       if (wpt->description != wpt->shortname) {
-#else
-      if (wpt->description && (strcmp(wpt->description, wpt->shortname) != 0)) {
-#endif
         temp = wpt->description;
       } else {
         temp = "";
@@ -660,11 +644,7 @@ route_disp_hdr_cb(const route_head* rte)
     gtxt_flags.route_header_written = 1;
     gbfprintf(fout, "\r\n\r\nHeader\t%s\r\n", headers[route_header]);
   }
-#if NEW_STRINGS
   print_string("\r\nRoute\t%s\t", current_trk->rte_name);
-#else
-  print_string("\r\nRoute\t%s\t", current_trk->rte_name ? CSTRc(current_trk->rte_name) : "");
-#endif
   print_distance(cur_info->length, 0, 1, 0);
   print_course(cur_info->first_wpt, cur_info->last_wpt);
   gbfprintf(fout, "\t%d waypoints\t", cur_info->count);
@@ -716,11 +696,7 @@ track_disp_hdr_cb(const route_head* track)
     gtxt_flags.track_header_written = 1;
     gbfprintf(fout, "\r\n\r\nHeader\t%s\r\n", headers[track_header]);
   }
-#if NEW_STRINGS
   print_string("\r\nTrack\t%s\t", current_trk->rte_name);
-#else
-  print_string("\r\nTrack\t%s\t", current_trk->rte_name ? CSTRc(current_trk->rte_name) : "");
-#endif
   print_date_and_time(cur_info->start, 0);
   print_date_and_time(cur_info->time, 1);
   print_distance(cur_info->length, 0, 1, 0);
index 669dd2073f191786404ceadacdc0c821abfa162d..7cf0c726a6585244b41a1106ea4eba3072e30cb4 100644 (file)
@@ -102,9 +102,6 @@ int gbfprintf(gbfile* file, const char* format, ...);
 int gbfputc(int c, gbfile* file);
 int gbfputs(const char* s, gbfile* file);
 int gbfputs(const QString& s, gbfile* file);
-#if NEW_STRINGS 
-typedef QString String;
-#endif
 int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file);
 int gbfflush(gbfile* file);
 
index 8f591774c526bb47d044937dee91f55019751f7f..90b2d6171bd6ed2aa9bf8bc737dbfb0883c39bab 100644 (file)
@@ -35,7 +35,6 @@ static QString instructions;
 static short_handle desc_handle;
 
 #define MYNAME "googledir"
-#define MY_CBUF 4096
 
 static xg_callback      goog_points, goog_poly_e;
 static xg_callback      goog_instr;
@@ -68,16 +67,16 @@ static long
 decode_goog64(const QByteArray& str, int& pos)
 {
   long result = 0;
-  unsigned char c = 0;
   unsigned char shift = 0;
 
   if (pos >= str.size()) {
     return 0;
   }
 
+  unsigned char c;
   do {
-    c = (unsigned char)str.at(pos++)-'?';
-    result |= (c & 31)<<shift;
+    c = str.at(pos++) - '?';
+    result |= (c & 31) << shift;
     shift += 5;
   } while (c & ~31);
 
@@ -95,11 +94,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes*)
   const QByteArray qbstr = encoded_points.toUtf8();
 
   route_head* routehead = route_head_alloc();
-#if NEW_STRINGS
   if (args == "overview_polyline") {
-#else
-  if (strcmp(args, "overview_polyline") == 0) {
-#endif
     routehead->rte_name = "overview";
     routehead->rte_desc = "Overview";
   } else {
@@ -110,10 +105,8 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes*)
     } else {
       utf_string utf;
       utf.is_html = 1;
-      utf.utfstring = /*QString::fromUtf8*/(instructions);
-      char *s = strip_html(&utf);
-      routehead->rte_desc = s;
-      xfree(s);
+      utf.utfstring = instructions;
+      routehead->rte_desc = strip_html(&utf);
       instructions = QString();
     }
   }
index a6c830cddade46d53bcf45fad01fc3f27341bc38..cc16df9c0a002bc96e6d2d919f4635a96f8d838d 100644 (file)
@@ -73,7 +73,6 @@ static format_specific_data** fs_ptr;
 
 
 #define MYNAME "GPX"
-#define MY_CBUF_SZ 4096
 #ifndef CREATOR_NAME_URL
 #  define CREATOR_NAME_URL "GPSBabel - http://www.gpsbabel.org"
 #endif
index 23109165b2f8b28885e47bc388ed207ccc81363d..c1feb527b54ab2d7f9d28a05227f2a1446c48622 100644 (file)
@@ -464,22 +464,14 @@ static void data_read(void)
 
 static void detect_pres_track(const route_head* rh)
 {
-#if NEW_STRINGS
   if (rh->rte_name.startsWith(PRESTRKNAME)) {
-#else
-  if (rh->rte_name && strncmp(rh->rte_name, PRESTRKNAME, 6) == 0) {
-#endif
     head = rh;
   }
 }
 
 static void detect_gnss_track(const route_head* rh)
 {
-#if NEW_STRINGS
   if (rh->rte_name.startsWith(GNSSTRKNAME)) {
-#else
-  if (rh->rte_name && strncmp(rh->rte_name, GNSSTRKNAME, 6) == 0) {
-#endif
     head = rh;
   }
 }
@@ -493,15 +485,9 @@ static void detect_other_track(const route_head* rh)
   }
   // Find other track with the most waypoints
   if (rh->rte_waypt_ct > max_waypt_ct &&
-#if NEW_STRINGS
       (rh->rte_name.isEmpty() || 
        (!rh->rte_name.startsWith(PRESTRKNAME) &&
        !rh->rte_name.startsWith(GNSSTRKNAME)))) {
-#else
-      (!rh->rte_name ||
-       (strncmp(rh->rte_name, PRESTRKNAME, 6) != 0 &&
-        strncmp(rh->rte_name, GNSSTRKNAME, 6) != 0))) {
-#endif
     head = rh;
     max_waypt_ct = rh->rte_waypt_ct;
   }
@@ -650,11 +636,7 @@ static void wr_header(void)
 static void wr_task_wpt_name(const Waypoint* wpt, const char* alt_name)
 {
   gbfprintf(file_out, "C%s%s\r\n", latlon2str(wpt),
-#if NEW_STRINGS
             !wpt->description.isEmpty() ? CSTR(wpt->description) : !wpt->shortname.isEmpty() ? CSTR(wpt->shortname) : alt_name);
-#else
-            wpt->description ? wpt->description : wpt->shortname ? wpt->shortname : alt_name);
-#endif
 }
 
 static void wr_task_hdr(const route_head* rte)
@@ -674,19 +656,11 @@ static void wr_task_hdr(const route_head* rte)
   // See if the takeoff and landing waypoints are there or if we need to
   // generate them.
   wpt = (Waypoint*) QUEUE_LAST(&rte->waypoint_list);
-#if NEW_STRINGS
   if (wpt->shortname.startsWith("LANDING")) {
-#else
-  if (wpt->shortname && strncmp(wpt->shortname, "LANDING", 6) == 0) {
-#endif
     num_tps--;
   }
   wpt = (Waypoint*) QUEUE_FIRST(&rte->waypoint_list);
-#if NEW_STRINGS
   if (wpt->shortname.startsWith("TAKEOFF")) {
-#else
-  if (wpt->shortname && strncmp(wpt->shortname, "TAKEOFF", 6) == 0) {
-#endif
     have_takeoff = 1;
     num_tps--;
   }
@@ -701,16 +675,10 @@ static void wr_task_hdr(const route_head* rte)
     fatal(MYNAME ": Bad task route timestamp\n");
   }
 
-#if NEW_STRINGS
   if (!rte->rte_desc.isEmpty()) {
     // desc will be something like "IGCDATE160701: 500KTri" 
     sscanf(CSTR(rte->rte_desc), DATEMAGIC "%6[0-9]: %s", flight_date, task_desc);
   }
-#else
-  if (rte->rte_desc) {
-    sscanf(rte->rte_desc, DATEMAGIC "%6[0-9]: %s", flight_date, task_desc);
-  }
-#endif
 
   gbfprintf(file_out, "C%s%s%s%04u%02u%s\r\n", date2str(tm),
             tod2str(tm), flight_date, task_num++, num_tps, task_desc);
index 0efd0f3d50ed5e22663c843377f06a63453e3511..bd04cceb7023b43584b127e879bf5c534b009d99 100644 (file)
@@ -92,11 +92,7 @@ ignr_start(xg_string args, const QXmlStreamAttributes* attrv)
 static void
 ignr_nb_etapes(xg_string args, const QXmlStreamAttributes* attrv)
 {
-#if NEW_STRINGS
   xmlpoints = args.toInt();
-#else
-  xmlpoints = atoi(args);
-#endif
 }
 
 static void
@@ -126,11 +122,7 @@ ignr_etape_end(xg_string args, const QXmlStreamAttributes* attrv)
 static void
 ignr_etape_pos(xg_string args, const QXmlStreamAttributes* attrv)
 {
-#if NEW_STRINGS
   ignr_xml_error((wpt == NULL) || (args.isEmpty()));
-#else
-  ignr_xml_error((wpt == NULL) || (args == NULL));
-#endif
 
   if (2 != sscanf(CSTRc(args), "%lf,%lf", &wpt->latitude, &wpt->longitude)) {
     fatal(MYNAME ": Invalid coordinates \"%s\"!\n", CSTRc(args));
index a17e74be954859a26a8980c4ab9757df787989fb..382184ae64967d89faba059f865dfb2d3da25ba2 100644 (file)
@@ -107,11 +107,7 @@ static void
 iktobj_type(xg_string args, const QXmlStreamAttributes*)
 {
   ikt_object_end();
-#if NEW_STRINGS
   switch (args.toInt()) {
-#else
-  switch (atoi(args)) {
-#endif
   case 0:
     waypt = new Waypoint;
     break;
index 975c34472286c8f2ed126937aad1ed172c154a29..50f26595eaba9ba1fc590bbbbcf8f0b9449c8392 100644 (file)
@@ -99,18 +99,9 @@ interpfilt_process(void)
                timen += interval) {
             Waypoint* wpt_new = new Waypoint(*wpt);
             wpt_new->SetCreationTime(timen);
-#if NEW_STRINGS
             wpt_new->shortname = QString();
             wpt_new->description = QString();
-#else
-            if (wpt_new->shortname) {
-              xfree(wpt_new->shortname);
-            }
-            if (wpt_new->description) {
-              xfree(wpt_new->description);
-            }
-            wpt_new->shortname = wpt_new->description = NULL;
-#endif
+
             linepart(lat1, lon1,
                      wpt->latitude, wpt->longitude,
                      (double)(timen-time1)/
@@ -137,18 +128,8 @@ interpfilt_process(void)
               Waypoint* wpt_new = new Waypoint(*wpt);
               wpt_new->SetCreationTime(distn/curdist*
                                        (wpt->creation_time.toTime_t() - time1) + time1);
-#if NEW_STRINGS
               wpt_new->shortname = QString();
               wpt_new->description = QString();
-#else
-              if (wpt_new->shortname) {
-                xfree(wpt_new->shortname);
-              }
-              if (wpt_new->description) {
-                xfree(wpt_new->description);
-              }
-              wpt_new->shortname = wpt_new->description = NULL;
-#endif
               linepart(lat1, lon1,
                        wpt->latitude, wpt->longitude,
                        distn/curdist,
index 94d72ba612acf448b91d028db8b71f4335e52940..0116773f8bad9708cd97c0be9d823fc64d04b321 100644 (file)
@@ -289,11 +289,7 @@ static char
 same_points(const Waypoint* A, const Waypoint* B)
 {
   return ( /* !!! We are case-sensitive !!! */
-#if NEW_STRINGS
            (A->shortname == B->shortname) &&
-#else
-           (strcmp(A->shortname, B->shortname) == 0) &&
-#endif
            (A->latitude == B->latitude) &&
            (A->longitude == B->longitude));
 }
index f313404634761f655b6f0b2155dcee23e8d5cb95..1d4972516a43c4effdfc03cb7e4d6d03bef894d9 100644 (file)
@@ -272,11 +272,7 @@ maggeo_waypt_pr(const Waypoint* waypointp)
   QString placeddate = maggeo_fmtdate(waypointp->creation_time);
   QString lfounddate = maggeo_fmtdate(waypointp->gc_data->last_found);
   QString cname = mkshort(desc_handle,
-#if NEW_STRINGS
                   waypointp->notes.isEmpty() ? waypointp->description : waypointp->notes);
-#else
-                  QString(waypointp->notes ? waypointp->notes : waypointp->description));
-#endif
   placer = waypointp->gc_data->placer;
 
   /*
index f052790cbb8cfba61aec175db0d4e15602262d99..3a044483aa43e4eda79ee87f06efb1a587dd6530 100644 (file)
@@ -663,11 +663,7 @@ mps_waypoint_w(gbfile* mps_file, int mps_ver, const Waypoint* wpt, const int isR
                                                                                + NULL (1) + prox(9) + display(4) + colour(4) + symbol(4) + city(sz) +
                                                                                state(sz) + facility(sz) + unknown2(1) + depth(9) + unknown3(7) */
     /* -1 as reclen is interpreted from zero meaning a reclength of one */
-#if NEW_STRINGS
     if (!wpt->notes.isEmpty()) {
-#else
-    if (wpt->notes) {
-#endif
       reclen += strlen(CSTRc(wpt->notes));
     }
   } else {
@@ -715,11 +711,7 @@ mps_waypoint_w(gbfile* mps_file, int mps_ver, const Waypoint* wpt, const int isR
     gbfputc(1, mps_file);
     gbfputdbl(mps_altitude, mps_file);
   }
-#if NEW_STRINGS
   if (!wpt->description.isEmpty()) {
-#else
-  if (wpt->description) {
-#endif
     gbfputs(ascii_description, mps_file);
   }
   gbfwrite(zbuf, 1, 1, mps_file);      /* NULL termination */
index 5d92cfecaad562e8e8dd3b0a51a1568a8e385dd6..010b32f186f48527e6baa065e3f6d3ed00f44ccc 100644 (file)
@@ -585,7 +585,7 @@ mkshort(short_handle h, const QString& istring)
  * As above, but arg list is a waypoint so we can centralize
  * the code that considers the alternate sources.
  */
-String
+QString
 mkshort_from_wpt(short_handle h, const Waypoint* wpt)
 {
   /* This probably came from a Groundspeak Pocket Query
@@ -594,27 +594,15 @@ mkshort_from_wpt(short_handle h, const Waypoint* wpt)
    * more stuff than should be in any one field...
    */
   if (wpt->gc_data->diff && wpt->gc_data->terr &&
-#if NEW_STRINGS
       !wpt->notes.isEmpty()) {
-#else
-      wpt->notes && wpt->notes[0]) {
-#endif
     return mkshort(h, wpt->notes);
   }
 
-#if NEW_STRINGS
   if (!wpt->description.isEmpty()) {
-#else
-  if (wpt->description) {
-#endif
     return mkshort(h, wpt->description);
   }
 
-#if NEW_STRINGS
   if (!wpt->notes.isEmpty()) {
-#else
-  if (wpt->notes) {
-#endif
     return mkshort(h, wpt->notes);
   }
 
index 5668af700ad5e0b8b4a31bc13073b46215f08608..6e18f672ab6b82d72879d6f17cde7b8368109495 100644 (file)
@@ -1231,7 +1231,7 @@ static void
 mmo_write_wpt_cb(const Waypoint* wpt)
 {
   char* str; 
-  String cx;
+  QString cx;
   int objid;
   time_t time;
   int icon = 0;
index f78b0ef4b49725102c2863223c969328906a1701..e95cbf03d6f75aff692b099a8c157387e1f542c0 100644 (file)
@@ -254,7 +254,7 @@ ng_waypt_rd(const Waypoint* wpt)
   WPNC.wp_data.North = (int32_t)lat;
   WPNC.wp_data.East = (int32_t)lon;
 
-  String s;
+  QString s;
   if (reorder_wp) {
     sprintf(temp_short_name, "A%03d", current_wp_ix);
     s = temp_short_name;
index f80e0d30c9a521a34423dd7ee752e2b016a50807..82f809589235ec14c5d9bd319dc1dcf203de0fec 100644 (file)
@@ -276,11 +276,7 @@ compare(const void* a, const void* b)
 
     Waypoint* wpt_a = ((const htable_t*)a)->wpt;
     Waypoint* wpt_b = ((const htable_t*)b)->wpt;
-#if NEW_STRINGS
     return wpt_a->description.compare(wpt_b->description);
-#else
-    return strcmp(wpt_a->description, wpt_b->description);
-#endif
   }
 }
 
index 22d607d1c9ff10fc7618243fc5a0d8e0154e67db..4dae1f5e58ea86cd0d77af0684766dfd771e4c3f 100644 (file)
@@ -1221,7 +1221,7 @@ nmea_wayptpr(const Waypoint* wpt)
 {
   char obuf[200];
   double lat,lon;
-  String s;
+  QString s;
   int cksum;
 
   lat = degrees2ddmm(wpt->latitude);
@@ -1243,11 +1243,6 @@ nmea_wayptpr(const Waypoint* wpt)
     gbfflush(file_out);
     gb_sleep(sleepus);
   }
-#if NEW_STRINGS
-#else
-  xfree(s);
-#endif
-
 }
 
 void
index f8e875b14b05fa8222e86101cea6169c91f83ff0..24fd69dc0c43437c5c3763eb7b52da77737c6d78 100644 (file)
@@ -278,11 +278,7 @@ static char
 same_points(const Waypoint* A, const Waypoint* B)
 {
   return ( /* !!! We are case-sensitive !!! */
-#if NEW_STRINGS
            (A->shortname == B->shortname) &&
-#else
-           (strcmp(A->shortname, B->shortname) == 0) &&
-#endif
            (A->latitude == B->latitude) &&
            (A->longitude == B->longitude));
 }
@@ -334,11 +330,7 @@ qsort_cb(const void* a, const void* b)
 {
   const Waypoint* wa = *(Waypoint**)a;
   const Waypoint* wb = *(Waypoint**)b;
-#if NEW_STRINGS
   return wa->shortname.compare(wb->shortname);
-#else
-  return strcmp(wa->shortname, wb->shortname);
-#endif
 }
 
 static void
index 9e63c0562e94ced4dee652a6553b05fc2ec2b998..c1b34a405617c51467b47eb184f738ca9baa8e1c 100644 (file)
@@ -507,11 +507,7 @@ any_hdr_calc_cb(const route_head* trk)
     return;
   }
 
-#if NEW_STRINGS
   if (rte_name.isEmpty() && !trk->rte_name.isEmpty()) {
-#else
-  if (rte_name.isEmpty() && trk->rte_name) {
-#endif
     rte_name = trk->rte_name;
     rte_desc = trk->rte_desc;
   }
index 602fd232cd9acaa09339e2d6930566f400677ff6..4b77abc07319a5c70b7140261020b4a5decab42c 100644 (file)
@@ -246,7 +246,7 @@ stmwpp_waypt_cb(const Waypoint* wpt)
   snprintf(cdate, sizeof(cdate), "%02d/%02d/%04d", tm.tm_mon, tm.tm_mday, tm.tm_year);
   snprintf(ctime, sizeof(ctime), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
 
-  String sn;
+  QString sn;
   switch (what) {
 
   case STM_WAYPT:
@@ -257,10 +257,6 @@ stmwpp_waypt_cb(const Waypoint* wpt)
       sn = mkshort(short_h, wpt->shortname);
     }
     gbfprintf(fout, "WP,D,%s,", CSTRc(sn));
-#if NEW_STRINGS
-#else
-    xfree(sn);
-#endif
     break;
 
   case STM_TRKPT:
index 2f15a5b2ba7728e2fae954ecca531ff58cf15617..66632b7afbee89dc774cdbe755f425a73b05615f 100644 (file)
@@ -196,11 +196,7 @@ waypoint_final()
 
   if (version < 2) {   /* keep the old behaviour */
     wpt_tmp->notes = wpt_tmp->description;
-#if NEW_STRINGS
     wpt_tmp->description = QString();
-#else
-    wpt_tmp->description = NULL;
-#endif
   }
 
   wpt_tmp->notes = fix_notes(wpt_tmp->shortname, wpt_tmp->notes);
index de21342feb48536260ffe646b25415dcff391325..3e88401250807f3d198c96010efde875f3222062 100644 (file)
@@ -173,17 +173,10 @@ tmpro_waypt_pr(const Waypoint* wpt)
 {
   int icon = 1; /* default to "flag" */
   int colour = 255; /*default to red */
-#if NEW_STRINGS
   QString shortname;
   QString description;
   if ((wpt->shortname.isEmpty()) || (global_opts.synthesize_shortnames)) {
     if (!wpt->description.isEmpty()) {
-#else
-  char* shortname = NULL;
-  char* description = NULL;
-  if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
-    if (wpt->description) {
-#endif
       if (global_opts.synthesize_shortnames) {
         shortname = mkshort_from_wpt(mkshort_handle, wpt);
       } else {
@@ -197,13 +190,8 @@ tmpro_waypt_pr(const Waypoint* wpt)
     shortname = csv_stringclean(wpt->shortname, ",\"");
   }
 
-#if NEW_STRINGS
   if (wpt->description.isEmpty()) {
     if (!shortname.isEmpty()) {
-#else
-  if (! wpt->description) {
-    if (shortname) {
-#endif
       description = csv_stringclean(shortname, ",\"");
     } else {
       description = xstrdup("");
@@ -234,15 +222,6 @@ tmpro_waypt_pr(const Waypoint* wpt)
             l ? l : ""
            );
 
-#if NEW_STRINGS
-#else
-  if (description) {
-    xfree(description);
-  }
-  if (shortname) {
-    xfree(shortname);
-  }
-#endif
   if (l) {
     xfree(l);
   }
index c41dd9f33102096f5eb27b399d4e7f4d418ab3a4..9db086a0487623d9191a2d3680c2294d9b0f6e58 100644 (file)
@@ -190,13 +190,8 @@ tpg_waypt_pr(const Waypoint* wpt)
    * and a shortname
    */
 
-#if NEW_STRINGS
   if ((wpt->shortname.isEmpty()) || (global_opts.synthesize_shortnames)) {
     if (!wpt->description.isEmpty()) {
-#else
-  if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
-    if (wpt->description) {
-#endif
       if (global_opts.synthesize_shortnames) {
         shortname = mkshort_from_wpt(mkshort_handle, wpt);
       } else {
@@ -209,11 +204,7 @@ tpg_waypt_pr(const Waypoint* wpt)
   } else {
     shortname = wpt->shortname;
   }
-#if NEW_STRINGS
   if (wpt->description.isEmpty()) {
-#else
-  if (! wpt->description) {
-#endif
     if (!shortname.isEmpty()) {
       description = shortname;
     } else {
index d73ed11507033c52bb100e68454b165cb7406614..4a5dc8c21c72d2b1894d2db7766633b509b6ae84 100644 (file)
@@ -1243,11 +1243,7 @@ unicsv_fatal_outside(const Waypoint* wpt)
 {
   gbfprintf(fout, "#####\n");
   fatal(MYNAME ": %s (%s) is outside of convertable area of grid \"%s\"!\n",
-#if NEW_STRINGS
         wpt->shortname.isEmpty() ? "Waypoint" : CSTR(wpt->shortname),
-#else
-        wpt->shortname ? CSTRc(wpt->shortname) : "Waypoint",
-#endif
         pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0),
         gt_get_mps_grid_longname(unicsv_grid_idx, MYNAME));
 }
@@ -1304,20 +1300,11 @@ unicsv_waypt_enum_cb(const Waypoint* wpt)
   if (!wpt->icon_descr.isNull()) {
     gb_setbit(&unicsv_outp_flags, fld_symbol);
   }
-#if NEW_STRINGS
   if (!wpt->description.isEmpty() && shortname != wpt->description) {
-#else
-  if (wpt->description && *wpt->description && shortname != wpt->description) {
-#endif
     gb_setbit(&unicsv_outp_flags, fld_description);
   }
-#if NEW_STRINGS
   if (!wpt->notes.isEmpty() && shortname != wpt->notes) {
     if ((wpt->description.isEmpty()) || (wpt->description != wpt->notes)) {
-#else
-  if (wpt->notes && *wpt->notes && shortname != wpt->notes) {
-    if ((! wpt->description) || (strcmp(wpt->description, wpt->notes) != 0)) {
-#endif
       gb_setbit(&unicsv_outp_flags, fld_notes);
     }
   }
index 3d8582158b13b93e930283ada8b5c2b225946f9e..041f414a0b323363507db6bf55d18500fea53a77 100644 (file)
@@ -170,12 +170,7 @@ vitosmt_read(void)
 
     double usec = fmod(1000000*seconds+0.5,1000000);
     wpt_tmp->SetCreationTime(mkgmtime(&tmStruct), lround(usec/1000.0));
-#if NEW_STRINGS
     wpt_tmp->shortname = QString().sprintf("WP%04d", ++serial);
-#else
-    wpt_tmp->shortname = (char*) xcalloc(16,1);
-    snprintf(wpt_tmp->shortname, 15 , "WP%04d", ++serial);
-#endif
 
     WAYPT_SET(wpt_tmp, speed, KNOTS_TO_MPS(speed)); /* meters per second */
     WAYPT_SET(wpt_tmp, course, course);
index 9425edc5c8977e755ca4f707e03786bbd21b6555..c84ebb37d9ecb60a9bfb02f83f1b9a800883ea06 100644 (file)
@@ -177,11 +177,7 @@ waypt_disp(const Waypoint* wpt)
   }
   printposn(wpt->latitude,1);
   printposn(wpt->longitude,0);
-#if NEW_STRINGS
   if (!wpt->description.isEmpty()) {
-#else
-  if (wpt->description) {
-#endif
     printf("%s/%s",
            global_opts.synthesize_shortnames ?
            qPrintable(mkshort(mkshort_handle, wpt->description)) :
@@ -559,15 +555,6 @@ Waypoint::Waypoint() :
   altitude(unknown_alt),
   depth(0),
   proximity(0),
-#if !NEW_STRINGS
-  shortname(NULL),
-  description(NULL),
-  notes(NULL),
-#endif
-  // url_link_list_(),
-  // wpt_flags(),
-  // icon_descr(),
-  // creation_time(),
   route_priority(0),
   hdop(0),
   vdop(0),
index 3ea2ce7caca4bb3f33cddf32639e157101f8f7dc..8d303ff71760f0aac294d2981265a5a593c15185 100644 (file)
@@ -54,7 +54,6 @@ arglist_t wfff_xml_args[] = {
 #define xfreez(p) { if (p) xfree(p); p=0; }
 
 #define MYNAME "wfff_xml"
-#define MY_CBUF 4096
 
 static xg_callback     wfff_s,      wfff_e;
 static xg_callback     wfff_wep,    wfff_mac,    wfff_type;
index 92558fe5b14112fda3af48bb7af85fef2fd6e4cd..05ea8134b32a8aed1f2b2ee6f166c61feb55a593 100644 (file)
@@ -139,11 +139,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag)
         // thus we will not process the EndElement case as we will issue a readNext first.
         // does a caller ever expect to be able to use both a cb_cdata and a
         // cb_end callback?
-#if NEW_STRINGS
         cb(c, NULL);
-#else
-        cb(CSTRE(c), NULL);
-#endif
         current_tag.chop(reader.qualifiedName().length() + 1);
       }
       break;
@@ -155,11 +151,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag)
 
       cb = xml_tbl_lookup(current_tag, cb_end);
       if (cb) {
-#if NEW_STRINGS
         cb(reader.name().toString(), NULL);
-#else
-        cb(CSTRE(reader.name().toString()), NULL);
-#endif
       }
       current_tag.chop(reader.qualifiedName().length() + 1);
       break;
index f75cd0abe4549963181e82d20e85d5e4b95d9737..f7880ac8bc2f7ed360a106c33bb4bfb5ed8e107d 100644 (file)
@@ -166,11 +166,7 @@ xol_fatal_outside(const Waypoint* wpt)
 {
   gbfprintf(fout, "#####\n");
   fatal(MYNAME ": %s (%s) is outside of convertable area \"%s\"!\n",
-#if NEW_STRINGS
         wpt->shortname.isEmpty() ? "Waypoint" : CSTRc(wpt->shortname),
-#else
-        wpt->shortname ? CSTRc(wpt->shortname) : "Waypoint",
-#endif
         pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0),
         gt_get_mps_grid_longname(grid_swiss, MYNAME));
 }